package cn.lili.controller.feign.member;

import cn.lili.modules.member.client.MemberEvaluationClient;
import cn.lili.modules.member.entity.dos.MemberEvaluation;
import cn.lili.modules.member.entity.dto.EvaluationQueryParams;
import cn.lili.modules.member.entity.dto.MemberEvaluationDTO;
import cn.lili.modules.member.entity.vo.EvaluationNumberVO;
import cn.lili.modules.member.entity.vo.MemberEvaluationVO;
import cn.lili.modules.member.entity.vo.StoreRatingVO;
import cn.lili.modules.member.service.MemberEvaluationService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author: ftyy
 * @date: 2022-01-12 10:39
 * @description: 会员商品评价 Feign
 */
@RestController
@RequiredArgsConstructor
public class MemberEvaluationFeignController implements MemberEvaluationClient {

    private final MemberEvaluationService memberEvaluationService;


    @Override
    public MemberEvaluationDTO addMemberEvaluation(MemberEvaluationDTO memberEvaluationDTO, Boolean isSelf) {
        return memberEvaluationService.addMemberEvaluation(memberEvaluationDTO, isSelf);
    }

    @Override
    public Boolean addMemberEvaluation(MemberEvaluation memberEvaluation) {
        return memberEvaluationService.addMemberEvaluation(memberEvaluation);
    }

    @Override
    public MemberEvaluationVO queryById(String id) {
        return memberEvaluationService.queryById(id);
    }

    @Override
    public boolean updateStatus(String id, String status) {
        return memberEvaluationService.updateStatus(id, status);
    }

    @Override
    public boolean delete(String id) {
        return memberEvaluationService.delete(id);
    }

    @Override
    public boolean reply(String id, String reply, String replyImage) {
        return memberEvaluationService.reply(id, reply, replyImage);
    }

    @Override
    public EvaluationNumberVO getEvaluationNumber(String goodsId) {
        return memberEvaluationService.getEvaluationNumber(goodsId);
    }

    /**
     * 统计商品评价数量
     *
     * @param evaluationQueryParams 查询条件
     * @return 商品评价数量
     */
    @Override
    public long getEvaluationCount(EvaluationQueryParams evaluationQueryParams) {
        return memberEvaluationService.getEvaluationCount(evaluationQueryParams);
    }

    /**
     * 商品会员评价数量
     *
     * @param evaluationQueryParams 查询条件
     * @return 评价数量
     */
    @Override
    public List<Map<String, Object>> memberEvaluationNum(EvaluationQueryParams evaluationQueryParams) {
        return memberEvaluationService.memberEvaluationNum(evaluationQueryParams);
    }

    /**
     * 获取店铺评分
     *
     * @param evaluationQueryParams 查询条件
     * @return 店铺评分
     */
    @Override
    public StoreRatingVO getStoreRatingVO(EvaluationQueryParams evaluationQueryParams) {
        return memberEvaluationService.getStoreRatingVO(evaluationQueryParams);
    }
}
